package core;

import model.BasicBlockSlot;
import model.BlockType;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import ui.UI;

import javax.swing.*;
import java.awt.*;

/**
 * Created by IntelliJ IDEA.
 * User: danielvilla
 * Date: 2/8/12
 * Time: 11:13 PM
 * To change this template use File | Settings | File Templates.
 */
public class Main {
    static Logger logger = Logger.getLogger(Main.class);
    static Dimension size = new Dimension(300, 300);

    public static void main(String args[]) {
        PropertyConfigurator.configure("tetris.log4j.properties");

        logger.debug("Starting application...");

        JFrame frame = new JFrame();

        UI ui = new UI();
        PlayerBoard board = new PlayerBoard(0, 20, 10);
        board.setSlot(19, 9, new BasicBlockSlot(BlockType.Blue));
        board.setSlot(19, 8, new BasicBlockSlot(BlockType.Blue));
        board.setSlot(19, 7, new BasicBlockSlot(BlockType.Red));
        board.setSlot(19, 6, new BasicBlockSlot(BlockType.Blue));
        board.setSlot(19, 5, new BasicBlockSlot(BlockType.Yellow));
        board.setSlot(19, 4, new BasicBlockSlot(BlockType.Blue));
        board.setSlot(19, 3, new BasicBlockSlot());
        board.setSlot(19, 2, new BasicBlockSlot(BlockType.Blue));
        board.setSlot(19, 1, new BasicBlockSlot(BlockType.Green));
        board.setSlot(19, 0, new BasicBlockSlot(BlockType.Blue));

        ui.displayBoard(board);
        frame.add(ui);
        // This works but is probably the wrong way to do things.
        frame.validate();
        frame.setTitle("Brick Assault");
//        frame.setPreferredSize(size);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);
    }
}
